package com.ruoyi.fatigue.controller;

import com.ruoyi.common.core.controller.BaseController;
import com.ruoyi.common.core.domain.R;
import com.ruoyi.fatigue.domain.vo.StartDetectionForm;
import com.ruoyi.fatigue.service.HttpUtilService;
import lombok.RequiredArgsConstructor;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;

/**
 * 首页面板接口
 *
 * @author wasd11203
 */
@Validated
@RequiredArgsConstructor
@RestController
@RequestMapping("/fatigue/dashboard")
public class DashBoardController extends BaseController {

    private final HttpUtilService httpUtilService;

    /**
     * 开始检测
     */
    @PostMapping("/start")
    public R<Void> start(@RequestBody StartDetectionForm form) {
        httpUtilService.startDetection(form);
        return R.ok();
    }

    /**
     * 停止检测
     */
    @PostMapping("/stop")
    public R<Void> stop() {
        httpUtilService.stopDetection();
        return R.ok();
    }
}
